#ifndef __ENCODERFACTORY_H
#define __ENCODERFACTORY_H


#include <encoder/encoder.h>
#include <encoder/curtis_encoder.h>
#include <encoder/aidike_encoder.h>

namespace encoder {

class EncoderFactory
{
public:

    EncoderFactory();
    ~EncoderFactory();

    static std::shared_ptr<Encoder>
    generateEncoder(std::shared_ptr<rclcpp::Node> node, 
       const std::string joint_name, 
       const int manufacturer)
    {
        std::shared_ptr<Encoder> e;
        switch (manufacturer) {
            case CURTIS_ENCODER:
                e = std::make_shared<CurtisEncoder>(node, joint_name);
                break;
            case AIDIKE_ENCODER:
                e = std::make_shared<AidikeEncoder>(node, joint_name);
                break;
            default:
                RCLCPP_ERROR(node->get_logger(), "unkown Encoder manufacturer: %d", manufacturer);
                e = nullptr;
                break;
        }
        return e;
    };
};

}

#endif